export interface AppConfig {
  port: number;
  nodeEnv: string;
  baseUrl: string;
  database: {
    url: string;
  };
  helius: {
    apiKey: string;
    network: 'devnet' | 'mainnet-beta' | 'testnet';
  };
  redis: {
    url: string;
  };
  jwt: {
    secret: string;
    expiresIn: string;
  };
  websocket: {
    corsOrigin: string;
  };
}

export const getConfig = (): AppConfig => ({
  port: parseInt(process.env.PORT || '7172', 10),
  nodeEnv: process.env.NODE_ENV || 'development',
  baseUrl: process.env.BASE_URL || 'http://localhost:7172',
  database: {
    url: process.env.DATABASE_URL || '',
  },
  helius: {
    apiKey: process.env.HELIUS_API_KEY || '',
    network: (process.env.SOLANA_NETWORK as any) || 'devnet',
  },
  redis: {
    url: process.env.REDIS_URL || 'redis://localhost:6379',
  },
  jwt: {
    secret: process.env.JWT_SECRET || 'dev_secret',
    expiresIn: process.env.JWT_EXPIRES_IN || '7d',
  },
  websocket: {
    corsOrigin: process.env.WEBSOCKET_CORS_ORIGIN || 'http://localhost:3000',
  },
});
